# build format
version: "{build}"

skip_branch_with_pr: true
skip_commits:
  files:
  - .git*
  - .travis.yml
  - _config.yml
  - LICENSE
  - '*.md'
  - '*.png'
  - '*.sh'

# configurations to add to build matrix
configuration:
  #- Debug
  - Release

environment:
  appveyor_yml_disable_ps_linux: true
  matrix:
    - job_name: clang, C++14
      appveyor_build_worker_image: Ubuntu
      CC: clang
      CXX: clang++
      SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_14=ON"

    - job_name: gcc, C++14
      appveyor_build_worker_image: Ubuntu
      CC: gcc
      CXX: g++
      SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_14=ON"

    # Representative for C++14
    - job_name: Visual Studio 2022, x64, C++14
      appveyor_build_worker_image: Visual Studio 2022
      platform: x64
      SQLITE_ORM_CXX_STANDARD: ""

    - job_name: clang, C++17
      appveyor_build_worker_image: Ubuntu
      CC: clang
      CXX: clang++
      SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_17=ON"

    - job_name: clang, C++20
      appveyor_build_worker_image: Ubuntu
      CC: clang
      CXX: clang++
      SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_20=ON"

    - job_name: gcc, C++17
      appveyor_build_worker_image: Ubuntu
      CC: gcc
      CXX: g++
      SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_17=ON"

    - job_name: gcc, C++20
      appveyor_build_worker_image: Ubuntu
      CC: gcc
      CXX: g++
      SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_20=ON"

    - job_name: Visual Studio 2022, x64, C++17
      appveyor_build_worker_image: Visual Studio 2022
      platform: x64
      SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_17=ON"

    - job_name: Visual Studio 2022, x64, C++20
      appveyor_build_worker_image: Visual Studio 2022
      platform: x64
      SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_20=ON"

    - job_name: Visual Studio 2022, x86, C++20
      appveyor_build_worker_image: Visual Studio 2022
      platform: x86
      SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_20=ON"

matrix:
  fast_finish: true

for:
-
  # Windows
  matrix:
    only:
      - appveyor_build_worker_image: Visual Studio 2015
      - appveyor_build_worker_image: Visual Studio 2022
  init:
    - |-
      echo %appveyor_build_worker_image% - %platform% - %configuration%
      if "%platform%"=="x64" (set architecture=-A x64)
      if "%platform%"=="x86" (set architecture=-A Win32)
      if "%appveyor_build_worker_image%"=="Visual Studio 2022" (set generator="Visual Studio 17 2022" %architecture%)
      if "%appveyor_build_worker_image%"=="Visual Studio 2015" (set generator="Visual Studio 14 2015" %architecture%)
  install:
    - |-
      cd C:\Tools\vcpkg
      git fetch --tags && git checkout 2023.01.09
      cd %APPVEYOR_BUILD_FOLDER%
      C:\Tools\vcpkg\bootstrap-vcpkg.bat -disableMetrics
      C:\Tools\vcpkg\vcpkg integrate install
      set VCPKG_DEFAULT_TRIPLET=%platform%-windows
      vcpkg install sqlite3 catch2
  before_build:
    - |-
      mkdir compile
      cd compile
      cmake %SQLITE_ORM_CXX_STANDARD% .. -G %generator% -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake
  # build examples, and run tests (ie make & make test)
  build_script:
    - |-
      cmake --build . --config %configuration%
      ctest --verbose --output-on-failure --build-config %configuration%

-
  # Linux
  matrix:
    only:
      - appveyor_build_worker_image: Ubuntu
  init:
    - |-
      echo $appveyor_build_worker_image
      $CXX --version
  # using custom vcpkg triplets for building and linking dynamic dependent libraries
  install:
    - |-
      pushd $HOME/vcpkg
      git fetch --tags && git checkout 2023.01.09
      popd
      $HOME/vcpkg/bootstrap-vcpkg.sh -disableMetrics
      $HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
      vcpkg install sqlite3 catch2 --overlay-triplets=vcpkg/triplets
  before_build:
    - |-
      mkdir compile
      cd compile
      cmake $SQLITE_ORM_CXX_STANDARD .. -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake
  # build examples, and run tests (ie make & make test)
  build_script:
    - |-
      cmake --build .
      ctest --verbose --output-on-failure
-
  # macOS
  matrix:
    only:
      - appveyor_build_worker_image: macOS
  init:
    - |-
      echo $appveyor_build_worker_image
      $CXX --version
  # using custom vcpkg triplets for building and linking dynamic dependent libraries
  install:
    - |-
      git clone --depth 1 --branch 2023.01.09 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
      $HOME/vcpkg/bootstrap-vcpkg.sh -disableMetrics
      $HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
      vcpkg install sqlite3 catch2 --overlay-triplets=vcpkg/triplets
  before_build:
    - |-
      mkdir compile
      cd compile
      cmake $SQLITE_ORM_CXX_STANDARD .. -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake
  # build examples, and run tests (ie make & make test)
  build_script:
    - |-
      cmake --build .
      ctest --verbose --output-on-failure
